var post_url='/attendance/ajax/';
var app = angular.module('he',['ui.router','ngSanitize','ngStorage']);
app.run(function($rootScope){
	$rootScope.static_url=static_url;
})
//设置app的取值符号，从{{  }}改为[[ ]]
app.config(function($interpolateProvider) {
	  $interpolateProvider.startSymbol('[[');
	  $interpolateProvider.endSymbol(']]');
	});

// 动态注册angularjs的组件
app.config(function($controllerProvider,$compileProvider,$filterProvider,$provide){
    app.register =
        {
            controller: $controllerProvider.register,
            directive: $compileProvider.directive,
            filter: $filterProvider.register,
            factory: $provide.factory,
            service: $provide.service
        };
});

app.factory('headFilterManager',function () {
	function HFManager(){
		this.filterList=[]
	}

	HFManager.prototype.initHeads=function (heads) {
		for (x in heads){
			if(heads[x].filter){
				heads[x]._filter={}
				this.filterList.push(heads[x]._filter)
			}
		}
	}

	HFManager.prototype.filter=function (records) {
		var out_records=records
		for(x in this.filterList){
			out_records=this.filterList[x].filter(out_records)
		}
		return out_records
	}
	HFManager.prototype.update_filter=function () {
		for(x in this.filterList){
			this.filterList[x].update_options()
		}
	}
	HFManager.prototype.has_filter=function(filter){
		return (this.filterList.indexOf(filter)!=-1)
	}
	
	return {
		HFManager:HFManager
	}
})